//
//  LeadPageViewController.m
//  MountEverestFM
//
//  Created by dllo on 15/11/8.
//  Copyright © 2015年 chenn. All rights reserved.
//

#import "LeadPageViewController.h"

@interface LeadPageViewController ()<UIScrollViewDelegate>

@property (nonatomic, strong) UIScrollView *leadScrollView;

@end

@implementation LeadPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 创建scollView
    self.leadScrollView = [[UIScrollView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
    _leadScrollView.delegate = self;
    _leadScrollView.bounces = NO;
    _leadScrollView.pagingEnabled = YES;
    _leadScrollView.userInteractionEnabled = YES;
    _leadScrollView.showsVerticalScrollIndicator = NO;
    _leadScrollView.contentSize = CGSizeMake(FM_Screen_Width * 3, FM_Screen_Height);
    [self.view addSubview:_leadScrollView];
    
    // 添加图片到scollView
    for (NSInteger i = 0; i < 3; i++) {
        
        
        UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectMake(FM_Screen_Width * i, 0, FM_Screen_Width, FM_Screen_Height)];
        NSString *leadStr = [NSString stringWithFormat:@"leadPage%ld.png", i];
        imageV.image = [UIImage imageNamed:leadStr];
        [self.leadScrollView addSubview:imageV];
        imageV.userInteractionEnabled= YES;
        // 如果是最后一页添加button
        if (i == 2) {
            imageV.userInteractionEnabled = YES;
            self.enter = [UIButton buttonWithType:UIButtonTypeRoundedRect];
            _enter.frame = CGRectMake(FM_Screen_Width / 2 - 100, FM_Screen_Height / 2 + 40, 200, 50);
            _enter.layer.borderColor = [[UIColor blueColor]CGColor];
            _enter.layer.borderWidth = 2;
            [_enter setTitle:@"马上体验" forState:UIControlStateNormal];
            [imageV addSubview:_enter];
        }
        
    
    }

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
